<?php

namespace app\portal\model;

use think\Model;

/**
 * Created by PhpStorm.
 * LICENSE: Apache 2.0
 * Date: 2019/3/8
 * Time: 上午12:57
 */
class MessageModel extends Model
{
    // 定义时间戳字段名
    protected $createTime = 'create_at';
    protected $updateTime = 'update_at';
    protected $autoWriteTimestamp = 'datetime';
    const STATUS_UNREAD = 0;
    const STATUS_READ = 1;
    const STATUS_MARK = 2;

    protected $table = 'portal_messages';

    public function getList()
    {
        $messages = $this->order('status', 'ASC')
            ->order('created_at', 'DESC')
            ->paginate(10);

        return $messages;
    }
}